-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable new linters #1162
base: main
Are you sure you want to change the base?
Enable new linters #1162
Conversation
986b2a5
to
daf93fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 of the commits look good(errname and removal of deprecated linters).
For the commit that fixes the unused-parameters, I suggest the following:
- If the function is a method(or part of a interface), do what you have done.
- If it is not a method, then don't use the _ method but remove the parameter from the function signature altogether and change the caller too.
13901aa
to
f5c98d3
Compare
@@ -191,7 +191,7 @@ func getSyncDRPolicy() *rmn.DRPolicy { | |||
var drstate string | |||
|
|||
// FakeProgressCallback of function type | |||
func FakeProgressCallback(drpcName string, state string) { | |||
func FakeProgressCallback(_ string, state string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must have specific signature:
// ProgressCallback of function type
type ProgressCallback func(string, string),
@@ -168,8 +168,8 @@ func (v *VRGInstance) kubeObjectsCaptureStartOrResumeOrDelay( | |||
} | |||
|
|||
func kubeObjectsCaptureStartConditionallySecondary( | |||
v *VRGInstance, result *ctrl.Result, | |||
captureStartGeneration int64, captureStartTimeSince, captureStartInterval time.Duration, | |||
v *VRGInstance, _ *ctrl.Result, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove these parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function must have a signature:
captureStartConditionally func(*VRGInstance, *ctrl.Result, int64, time.Duration, time.Duration, func())
@@ -187,7 +187,7 @@ func kubeObjectsCaptureStartConditionallySecondary( | |||
|
|||
func kubeObjectsCaptureStartConditionallyPrimary( | |||
v *VRGInstance, result *ctrl.Result, | |||
captureStartGeneration int64, captureStartTimeSince, captureStartInterval time.Duration, | |||
_ int64, captureStartTimeSince, captureStartInterval time.Duration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function must have a signature:
captureStartConditionally func(*VRGInstance, *ctrl.Result, int64, time.Duration, time.Duration, func())
@@ -1788,14 +1788,14 @@ func pvcUnprotectedVerify( | |||
type pvcPreDeleteVerify func(ramendrv1alpha1.VolumeReplicationGroup, types.NamespacedName, string) | |||
|
|||
func vrgPvcStatusAbsentVerify( | |||
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, pvName string, | |||
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, _ string, | |||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function must have signature:
type pvcPreDeleteVerify func(ramendrv1alpha1.VolumeReplicationGroup, types.NamespacedName, string)
) { | ||
By("not storing PVC in VRG's status") | ||
Expect(vrgController.FindProtectedPVC(&vrg, pvcNamespacedName.Namespace, pvcNamespacedName.Name)).To(BeNil()) | ||
} | ||
|
||
func pvcClusterDataProtectedFalseVerify( | ||
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, pvName string, | ||
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, _ string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function must have signature:
type pvcPreDeleteVerify func(ramendrv1alpha1.VolumeReplicationGroup, types.NamespacedName, string)
@@ -1835,7 +1835,7 @@ func pvcClusterDataProtectedStatusVerify( | |||
|
|||
type pvcPostDeleteVerify func(types.NamespacedName, string) | |||
|
|||
func vrAndPvcDeletionTimestampsRecentVerify(pvcNamespacedName types.NamespacedName, pvName string) { | |||
func vrAndPvcDeletionTimestampsRecentVerify(pvcNamespacedName types.NamespacedName, _ string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function must have signature:
type pvcPreDeleteVerify func(ramendrv1alpha1.VolumeReplicationGroup, types.NamespacedName, string)
controllers/drcluster_controller.go
Outdated
@@ -449,7 +449,7 @@ func validateCIDRsFormat(drcluster *ramen.DRCluster, log logr.Logger) error { | |||
return nil | |||
} | |||
|
|||
func (r DRClusterReconciler) processDeletion(u *drclusterInstance) (ctrl.Result, error) { | |||
func processDeletion(u *drclusterInstance) (ctrl.Result, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep this as a method. You can probably remove the receiver like you have in other cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
controllers/drplacementcontrol.go
Outdated
homeCluster := "" | ||
homeClusterNamespace := "" | ||
homeCluster = "" | ||
homeClusterNamespace = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove these lines as null value of string is empty string in go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
36d3378
to
1544fe5
Compare
935ac2e
to
ed46af5
Compare
74306f0
to
ebc2060
Compare
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
Signed-off-by: Elena Gershkovich <[email protected]>
ebc2060
to
ba24b63
Compare
1841da2
to
6452c50
Compare
No description provided.